<?php

class Setting_model extends CI_Model
{
  private $table = 'settings';

  function getSetting($slug = '')
  {
    $this->db->select('*');
    if ($slug != '') {
      $this->db->where('slug', $slug);
      $this->db->limit(1);
    }
    $query = $this->db->get(PREFIX . 'settings');

    if ($query->result()) {
      $data = $query->result();
      if (!$slug) {
        $retval = array();
        foreach ($data as $key => $value) {
          $retval[$value->slug] = $value->content;
        }
      } else
        $retval = $data;
      return $retval;
    } else {
      return false;
    }
  }
}